1. Field of the Invention
The present invention relates to an illumination setting method, an illumination setting apparatus, and computer-readable medium for a brightness tool of an image measuring apparatus. In particular, the present invention relates to an illumination setting method, an illumination setting apparatus, and computer-readable medium for brightness tool of an image measuring apparatus that identify a measured object by capturing an image of the measure object, the image measuring apparatus being suitable as an image measuring apparatus equipped with a camera and an illumination device, such as a CNC image measurer, an image unit (microscope with a motor drive stage), a hardness tester, and an image probe of a CNC three-dimensional measurer. The computer software for brightness tool sets illumination such that brightness of a measured image of an actually captured image of a measured article during execution of a part program is identical to brightness of a measured image of a captured image during creation of a part program.
2. Description of Related Art
An image measuring apparatus having an autofocus function moves an image capturer, such as a camera, or an optical system thereof along an optical axis direction and sequentially captures images of a measured object, and then determines that a position in the optical axis direction where an image having the highest contrast is captured becomes a focus position (Japanese Patent Laid-Open Publication No. 2009-168607).
When such an image measuring apparatus uses a USB camera as an image capturer, a frame rate is increased in a limited image capture range during image autofocus due to constraints of a transfer rate. This shortens an exposure time, resulting in a dark captured image and poor autofocus accuracy. Thus, illumination intensity of an illumination device needs to be adjusted according to the frame rate. The present applicant suggested in Japanese Patent Laid-Open Publication No. 2012-151714 that an increase in a frame rate of an image capturer and a decrease in an exposure time associated therewith be compensated by an increase in an amount of light of an illumination device.
Meanwhile, an LED illumination device using an LED device as a light source defines a standard of an illumination intensity curve and performs calibration in order to reduce variation in LED devices.
Specifically, with reference to FIG. 1, (1) Values of current flowing through an LED device (a digital/analog conversion (DAC) value and a pulse width modulation (PWM) value in a low illumination area where current control is difficult) are first changed from 0 to a maximum value (65535 in the drawing), and then current/illumination intensity curve data of the LED device is obtained as shown on the right-hand side in FIG. 1.
(2) Based on the current/illumination intensity curve data obtained in (1), the current values (DAC value and PWM value) associated with an illumination intensity instruction value/illumination intensity standard curve as shown in the center of FIG. 1 are then calculated (a current (DAC) value of 31744 at an illumination intensity instruction value of 80% in FIG. 1), the illumination intensity instruction value/illumination intensity standard curve representing a relationship between an illumination intensity instruction value given to an illumination device and actual illumination intensity of the illumination device.
The illumination intensity instruction value herein is a % value of brightness instructed to the illumination device from software of a personal computer (PC), for example, where the maximum illumination intensity [Lx] of a standard defined for each model of an illumination device is 100% and a state of no illumination is 0%. Since brightness control similar to halogen lighting, which is conventionally used for an image measurer, is desirable, the illumination intensity instruction value in the % value and the actual illumination intensity [Lx] of the illumination device establishes an exponential relationship.
(3) A calibration table (illumination intensity instruction value/current values (DAC value and PWM value)) is then created from the current values calculated in (2), as shown in the left-hand side in FIG. 1, and is then written in a non-volatile memory, for example, an EEPROM, of an illumination controller.
To set the illumination intensity for image autofocus, (1) The illumination intensity [Lx] required is calculated according to an exposure time of image autofocus. With an illumination intensity instruction value of 40% before limiting an image capture range, when the image capture range is limited to ½, for example, and a frame rate is doubled, the exposure time is ½. To maintain the brightness of the captured image, the illumination intensity instruction value is doubled to 80%.
(2) The calculated instruction value (80%) is then set on the illumination controller and the LED device is activated.
Essentially, when the exposure time (1/frame rate) changes, the illumination intensity [Lx] needs to be changed accordingly. The calibration table in an EEPROM, for example, however, stores only the illumination intensity instruction value and the current values (DAC value and PWM value), as shown in the left-side in FIG. 1. Thus, the target illumination intensity cannot be calculated without the current illumination intensity. In a case where software stores the illumination intensity instruction value/illumination intensity standard curve of the illumination device, the calibration table does not need to include illumination intensity data. To this end, the software needs to include in advance product standard information of all illumination device. When a new illumination device is added as a new product, the software needs to be updated to include standard information of the new illumination device.
Furthermore, illumination devices of the same model type are adjusted to fit the illumination intensity instruction value/illumination intensity standard curve. Practically, however, the standard curve has a substantial range of tolerance as shown in the center of the FIG. 1 to increase the yield of LED devices and reduce the man-hour for adjustment. The tolerance of the illumination intensity [Lx] at an illumination intensity instruction value of 20% or more is within ±5%, for example, and is gradually widened toward dark from 20% or less. The tolerance of the illumination intensity [Lx] of the illumination device at an illumination intensity instruction value of 1% is within ±50%, for example.
Thus, as shown in FIG. 2, the actual illumination intensity is slightly different depending on a device even among illumination devices of the same model type. The illumination intensity of illumination devices is different between an illumination device A, which is close to an upper limit of the tolerance, and an illumination device B, which is close to a lower limit thereof, even with the same illumination intensity instruction value. In some cases, the illumination intensity of an illumination device does not change at a rate of the standard. An illumination device C shown in FIG. 2 changes the illumination intensity at a rate greater than the standard. The tolerance is wider as the illumination intensity instruction value is lower. Thus, when the illumination intensity instruction value is lowered during measurement of a work piece having a high reflection rate, such as a mirror, this issue is noticeable. Accordingly, the illumination intensity is substantially out of the target, preventing accurate image autofocus.
For measurement using a camera, a contrast between end sections of a measured article (also referred to as a work piece) is detected based on a captured image, and a distance between the end sections is produced as a measurement result. Specifically, an optimum contrast is required for accurate measurement. Such an optimum contrast is provided by an illumination device mounted to an image measuring apparatus. The illumination device can adjust illumination in a wide range according to an instruction from a personal computer or a measurer main body. In actual measurement, the illumination intensity instruction value is adjusted to provide an optimum contrast for measurement of end sections of a work piece, and then measurement is performed.
When a plurality of work pieces of the same type are measured, it is cumbersome to fine-tune the illumination intensity instruction value every time a work piece is replaced. Thus, in such a case where work pieces of the same type are repeatedly measured, mostly the illumination intensity instruction value is determined once and fixed for measurement even when a work piece is replaced. In this method, however, brightness of measured images of captured images is not strictly the same in cases below, and thus measurement results are less reliable.
(1) Even with the same amount of light, the brightness of a measured image of a captured image is different due to a surface condition of a work piece or processing.
(2) An image measuring apparatus is different and the same amount of light is not provided even with the same illumination intensity instruction value.
(3) Even with the same image measuring apparatus, the same amount of light is not provided as before due to attenuation of illumination intensity attributed to deterioration with age of an illumination device.
To address the circumstances above, a brightness tool is used in which reference brightness of a measured image of a captured image is registered in such repetitive measurement above (part program measurement), and even when work pieces change, the illumination intensity instruction value is automatically fine-tuned to provide the same brightness of a measured image of a captured image.
In the brightness tool, as shown in FIG. 3, first in Step S100, an illumination device is activated at an illumination intensity instruction value x0 during creation of a part program to obtain brightness y0 of a measured image of a captured image and set x1=100 (initial value).
Then, in Step S110, brightness y1 of the measured image of the captured image at x1 is obtained.
Then, in Step S120, (x0, y0) and (x1, y1) are interpolated as shown in FIG. 4 to calculate a next illumination intensity instruction value xnext that provides a target brightness ytarget of the measured image.
Then, in Step S130, a determination is made as to whether an absolute value of difference between xnext and x1 is equal to or less than a threshold value.
When the determination is no, the process proceeds to Step S140 to set x0=×1, y0=y1, and x1=xnext, and then returns to Step S110.
On the other hand, when the determination in Step S130 is yes, the proceeds ends.
This brightness tool allows a measurer to eliminate an effort to manually fine-tune the illumination intensity instruction value and achieves highly reliable measurement results.
Even in this brightness tool, however, the changing illumination intensity instruction value xnext to the illumination device is a predicted value and the brightness ytarget of the measured image of the captured image as a final target is attained through so-called trial and error. Thus, it takes time due to a large number of times of trial and error.
In addition, in a series of operations of “changing the illumination intensity instruction value to the illumination device→obtaining an actual image→confirming brightness of a measured image of the actually obtained image,” it takes time before the illumination intensity of the illumination device is stabilized after the change and software needs to wait for a convergence time. Specifically, halogen lighting is slow in response in unit of second due to its principle of using emission of light from heating a filament. On the other hand, LED lighting is quick in response. However, since the amount of light emission is susceptible to change in surrounding temperature, the illumination intensity is not stable for a certain period of time due to change in self-heating associated with the change of the illumination intensity instruction value. As a result, it takes time to execute the brightness tool.